/*
 * SASettingslistView.cpp
 *
 *  Created on: 2010-06-06
 *      Author: Frost Feng
 */

// INCLUDE FILES
#include <aknviewappui.h>
#include <avkon.hrh>
#include <SMSAssist_0xEB692DC8.rsg>

#include "SASettingslistView.h"
#include "SASettingslistContainer.h" 

#include "SAAppUi.h"
#include "SAMainview.h"

#include "SA.hrh"



// ================= MEMBER FUNCTIONS =======================

// ---------------------------------------------------------
// CSASettingslistView::ConstructL(const TRect& aRect)
// EPOC two-phased constructor
// ---------------------------------------------------------
//
void CSASettingslistView::ConstructL()
{
    BaseConstructL( R_PA_SETTINGSLIST_VIEW);
}

// ---------------------------------------------------------
// CSASettingslistView::~CSASettingslistView()
// destructor
// ---------------------------------------------------------
//
CSASettingslistView::~CSASettingslistView()
{
    if ( iContainer )
    {
        AppUi()->RemoveFromViewStack( *this, iContainer );
    }

    delete iContainer;
}

// ---------------------------------------------------------
// TUid CSASettingslistView::Id()
//
// ---------------------------------------------------------
//
TUid CSASettingslistView::Id() const
{
    return TUid::Uid(ESASettingslistViewId);
}

// ---------------------------------------------------------
// CSASettingslistView::HandleCommandL(TInt aCommand)
// takes care of view command handling
// ---------------------------------------------------------
//
void CSASettingslistView::HandleCommandL(TInt aCommand)
{
    iContainer->HandleCommandFromContainerL(aCommand);
}

// ---------------------------------------------------------
// CSASettingslistView::HandleClientRectChange()
// ---------------------------------------------------------
//
void CSASettingslistView::HandleClientRectChange()
{
    if ( iContainer )
    {
        iContainer->SetRect( ClientRect() );
    }
}

// ---------------------------------------------------------
// CSASettingslistView::DoActivateL(...)
// 
// ---------------------------------------------------------
//
void CSASettingslistView::DoActivateL(
   const TVwsViewId& /*aPrevViewId*/,TUid /*aCustomMessageId*/,
   const TDesC8& /*aCustomMessage*/)
    {
    if (!iContainer)
        {
        iContainer = new (ELeave) CSASettingslistContainer(*saAppUi,(*saAppUi).iSettings);
        iContainer->SetMopParent(this);
        iContainer->ConstructL( ClientRect() );
        AppUi()->AddToStackL( *this, iContainer );
        } 
   }

// ---------------------------------------------------------
// CSASettingslistView::DoDeactivate()
// 
// ---------------------------------------------------------
//
void CSASettingslistView::DoDeactivate()
    {
    if ( iContainer )
        {
        AppUi()->RemoveFromViewStack( *this, iContainer );
        }
    
    delete iContainer;
    iContainer = NULL;
    }
// ---------------------------------------------------------
// void CSASettingslistView::DynInitMenuPaneL(TInt aResourceId,CEikMenuPane* aMenuPane)
//
// ---------------------------------------------------------
//
void CSASettingslistView::DynInitMenuPaneL(TInt aResourceId,CEikMenuPane* aMenuPane)
{
    if(iContainer)
    {
        iContainer->DynInitMenuPaneFromContainerL(aResourceId, aMenuPane);
    }
}


